package com.huluobo.a2107monthdemo.cart

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.huluobo.a2107monthdemo.R
import com.huluobo.a2107monthdemo.utils.ImageUtil

/**
 *  Created by LC on 2023/12/1.
 */
class CartAdapter(list: MutableList<CartBean>) : BaseQuickAdapter<CartBean, BaseViewHolder>(R.layout.item_cart, list) {
    override fun convert(helper: BaseViewHolder, item: CartBean) {
        ImageUtil.loadImage(context, item.goods_default_icon, helper.getView(R.id.cart_item_iv_icon))
        helper.setText(R.id.cart_item_tv_name, item.goods_desc)
        helper.setText(R.id.cart_item_tv_price, item.goods_default_price.toString())
        helper.setText(R.id.cart_item_tv_num, item.count.toString())
        helper.getView<CheckBox>(R.id.cart_item_cb).isChecked = item.isChecked
    }
}